﻿<%@ Page Title="" Language="C#" MasterPageFile="~/HRSys.Master" AutoEventWireup="true"
    CodeBehind="EditDict.aspx.cs" Inherits="HRWebSite.Sys.EditDict" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<title id="Title1" runat="server">字典管理</title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div>
        <table width="600px">
            <tr>
                <td class="td-odd">
                    名称
                </td>
                <td class="td-even">
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                </td>
                <td class="td-odd">
                    类型
                </td>
                <td class="td-even">
                    <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">
                        <asp:ListItem Value="1">职称</asp:ListItem>
                        <asp:ListItem Value="2">雇佣</asp:ListItem>
                        <asp:ListItem Value="3">请假</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td class="td-but">
                    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="添加" />
                </td>
            </tr>
        </table>
    </div>
    <div>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"
            DataKeyNames="DictID" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None"
            Width="523px">
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:BoundField DataField="Name" HeaderText="名称" SortExpression="Name">
                    <ItemStyle Width="100px" />
                </asp:BoundField>
                <asp:TemplateField HeaderText="类型" SortExpression="Type">
                    <EditItemTemplate>
                        <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" SelectedValue='<%# Bind("Type") %>'>
                            <asp:ListItem Value="1">职称</asp:ListItem>
                            <asp:ListItem Value="2">雇佣</asp:ListItem>
                            <asp:ListItem Value="3">请假</asp:ListItem>
                        </asp:DropDownList>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" Enabled="False"
                            SelectedValue='<%# Eval("Type") %>'>
                            <asp:ListItem Value="1">职称</asp:ListItem>
                            <asp:ListItem Value="2">雇佣</asp:ListItem>
                            <asp:ListItem Value="3">请假</asp:ListItem>
                        </asp:DropDownList>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="Order" HeaderText="排序" SortExpression="Order" />
                <asp:CommandField CancelText="取消" DeleteText="删除" EditText="编辑" HeaderText="操作" ShowDeleteButton="True"
                    ShowEditButton="True" UpdateText="更新">
                    <ItemStyle Width="100px" />
                </asp:CommandField>
            </Columns>
            <EditRowStyle BackColor="#2461BF" />
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#EFF3FB" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#F5F7FB" />
            <SortedAscendingHeaderStyle BackColor="#6D95E1" />
            <SortedDescendingCellStyle BackColor="#E9EBEF" />
            <SortedDescendingHeaderStyle BackColor="#4870BE" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:HRSys %>"
            DeleteCommand="DELETE FROM [Dict] WHERE [DictID] = @DictID" InsertCommand="INSERT INTO [Dict] ([Name], [Type], [Order]) VALUES (@Name, @Type, @Order)"
            SelectCommand="SELECT * FROM [Dict] WHERE ([Type] = @Type) ORDER BY DictID" UpdateCommand="UPDATE [Dict] SET [Name] = @Name, [Type] = @Type, [Order] = @Order WHERE [DictID] = @DictID">
            <DeleteParameters>
                <asp:Parameter Name="DictID" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="Name" Type="String" />
                <asp:Parameter Name="Type" Type="Int32" />
                <asp:Parameter Name="Order" Type="Int32" />
            </InsertParameters>
            <SelectParameters>
                <asp:ControlParameter ControlID="DropDownList1" Name="Type" PropertyName="SelectedValue"
                    Type="Int32" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="Name" Type="String" />
                <asp:Parameter Name="Type" Type="Int32" />
                <asp:Parameter Name="Order" Type="Int32" />
                <asp:Parameter Name="DictID" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>
    </div>
</asp:Content>
